#include <stdio.h>

long long w, h;
long long lcm;
int gcdWH;
long long numTiles;

int gcd(int a, int b) {
	if (!b) return a;
	return gcd(b, a%b);
}

int main() {
	while(1) {
		scanf("%lld %lld", &w, &h);
		if (w==0 && h==0) break;
		gcdWH = gcd(w,h);

		lcm = (w/gcdWH)*h;
		numTiles = lcm/gcdWH;

		printf("%lld\n", numTiles);
	}

	return 0;
}
